package com.thread.www.demo;

/**
 * @author 新技术软件：汪洋
 */
public class Count {
    private int num = 0;
    public synchronized void add(){
        try {
            Thread.sleep(50);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        num++;
        System.out.println(Thread.currentThread().getName() + "-" + num);
    }
    public int getNum(){
        return num;
    }
}
